Relativity as based on a meta-physical law
With Newtonian physics, we looked at the world and discovered the laws. We when looked at the laws and saw that the principle of Galilean relatively holds for mechanics, later we see it does not for EM.
With relativity, we first impose a meta-physical constraint that all laws of physics – including EM – have to be the same in different inertial frames. From this restriction we then derive the laws.
Follow-ups
Links:
Relativity Teaching Physics Modern Essentials
202501171002